package com.java.client;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.java.entity.User;
import com.java.service.ICalculatorService;
import com.java.service.IUserService;
import com.java.service.impl.UserServiceImpl;  
  
/** 
* @ClassName: SpringCalculatorWsClient 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author undoner@gmail.com
* @date 2017年1月24日 上午10:19:59 
*/
public class SpringCalculatorWsClient {  
	private static final Logger logger = LoggerFactory.getLogger(SpringCalculatorWsClient.class);
  
    public static void main(String[] args) {  
        // 调用WebService  
    	logger.debug("#############Client getUserByName##############"); 
        JaxWsProxyFactoryBean calculatorFactory = new JaxWsProxyFactoryBean();  
        calculatorFactory.setServiceClass(IUserService.class);  
        calculatorFactory.setAddress("http://localhost:8080/SpringCxfServer/calculator");
        
        ICalculatorService calculatorService = (ICalculatorService) calculatorFactory.create();  
        Float res1 = calculatorService.plus(1, 2);
        logger.debug(res1.toString());
        Float res2 = calculatorService.divide(1, 2);
        logger.debug(res2.toString());
        Float res3 = calculatorService.minus(1, 2);
        logger.debug(res3.toString());
        Float res4 = calculatorService.multiply(1, 2);
        logger.debug(res4.toString());
    }  
}  
